﻿Imports System.Xml

Namespace HybrisItems.Model

    ''' <summary>
    ''' An AtomicType represents a simple java object. (The name 'atomic' just means 'non-composed' objects.)
    ''' </summary>
    ''' <remarks></remarks>
    <Serializable()> _
    Public Class AtomicTypeModel
        Inherits TypeModel

        Public Sub New()

        End Sub

        Public Sub New(Node As XmlNode)

            Fill(Node)

        End Sub

        Public Sub Fill(Node As XmlNode)

            Me.Class.Value = ConfigParser.GetAttribute(Node, "class", "java.lang.Object")
            Me.Extends.Value = ConfigParser.GetAttribute(Node, "extends", "java.lang.Object")
            Me.AutoCreate = ConfigParser.GetAttribute(Node, "autocreate", AutoCreate)
            'Me.Generate = ConfigParser.GetAttribute(Node, "generate")

        End Sub

        ''' <summary>
        ''' Corresponding Java class in the hybris Suite; will also be used as the code of the atomic type.
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Property [Class] As New ClassModel

        ''' <summary>
        ''' If 'true', the AtomicType will be created during initialization.
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Property AutoCreate As Boolean = False

        ''' <summary>
        ''' Deprecated. Has no effect for atomic types. Default is 'true'.
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        <Obsolete()>
        Public Property Generate As Boolean = True

        ''' <summary>
        ''' Defines the class which will be extended. Default is 'java.lang.Object'.
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Property Extends As New ClassModel

#Region "Type Overrides"

        Private _IsWired As Boolean = False

        Public Overrides ReadOnly Property IsWired As Boolean
            Get
                Return _IsWired
            End Get
        End Property

        Public Overrides Sub Wire(Model As EntireHybrisSystemModel)
            _IsWired = True
        End Sub

#End Region

    End Class

End Namespace
